package com.beehoo.dcportal.dao.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.beehoo.dcportal.common.base.BaseDao;
import com.beehoo.dcportal.common.base.BaseException;
import com.beehoo.dcportal.dao.IRelatedLinkDao;
import com.beehoo.dcportal.model.RelatedLinkBean;

public class RelatedLinkDaoImpl extends BaseDao implements IRelatedLinkDao {
	
	private static final Logger logger = Logger.getLogger(RelatedLinkDaoImpl.class);

	@SuppressWarnings("unchecked")
	@Override
	public List<RelatedLinkBean> getRelatedLinkList(String streetId,
			String linkType) throws BaseException {
		List<RelatedLinkBean> linkList = new ArrayList<RelatedLinkBean>();
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("streetId", streetId);
		paramMap.put("linkType", linkType);
		
		try {
			linkList = (List<RelatedLinkBean>)sqlMapClient.queryForList("portal-link.getRelatedLinkList", paramMap);
			
			logger.info("链接列表-获取友情链接列表|#调用portal-link.getRelatedLinkList " +
					"中心编号："+streetId+
					"链接类型："+linkType+",成功!");
		} catch (SQLException e) {
			logger.error("链接列表-获取友情链接列表|#调用portal-link.getRelatedLinkList " +
					"中心编号："+streetId+
					"链接类型："+linkType+",失败!", e);
			throw new BaseException(e, "获取友情链接列表失败");
		}
		
		return linkList;
	}

}
